package spark.SecondarySort

/**
  * Ordered 相当于 Comparable
  */
class Person(val name:String,val age:Int) extends Serializable with Ordered[Person]{
	
	override def compare(that: Person): Int = {
		if(this.name != that.name){
			this.name.compareTo(that.name)
		}else{
			this.age - that.age
		}
	}
	
	override def toString: String = this.name +"\t"+this.age
}
